

//
//  WHBaseSectionHeaderView.m
//  WHPersonalData
//
//  Created by shengmeng chen on 2019/5/31.
//  Copyright © 2019 mac. All rights reserved.
//

#import "WHBaseSectionHeaderView.h"
#import "SDAutoLayout.h"

@implementation WHBaseSectionHeaderView

-(void)createUIControls
{
    [super createUIControls];
    
    self.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
    /**  标题,标题  **/
    UILabel*titleLabel = [[UILabel alloc]init];
    titleLabel.font =  [UIFont systemFontOfSize:12*WidthScale>16?16:12*WidthScale];
    titleLabel.textColor =[UIColor grayColor];
    [self addSubview:titleLabel];
    titleLabel.numberOfLines =0;
    titleLabel.text = @"标题,标题,标题,标题,标题,标题";
    self.titleLabel = titleLabel;
    
    UIButton*comeButton = [[UIButton alloc]init];
    [comeButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    
    comeButton.titleLabel.font =[UIFont systemFontOfSize:20*WidthScale>22?22:20*WidthScale];
    [comeButton addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
    [comeButton setImage:[UIImage imageNamed:@"more_info"] forState:UIControlStateNormal];
    
    comeButton.hidden = YES;
    self.comeButton = comeButton;
    [self addSubview:comeButton];
    
    //新建tap1手势
    UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGestureView:)];
    //设置点击次数和点击手指数
    tapGesture.numberOfTapsRequired = 1; //点击次数
    tapGesture.numberOfTouchesRequired = 1; //点击手指数
    [self addGestureRecognizer:tapGesture];
    
    /**  分割线     **/
    UIView*separatorLine =[[UIView alloc]init];
    separatorLine.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self addSubview:separatorLine];
    self.separatorLine = separatorLine;
    
}

-(void)setUpUIControlsLayout
{
    [super setUpUIControlsLayout];
    
    /**   标题,标题  **/
    _titleLabel.sd_layout.
    topSpaceToView(self,0)
    .leftSpaceToView(self,kMarginH)
    .rightSpaceToView(self,kMarginH*2)
    .autoHeightRatio(0);
    
    self.comeButton.sd_layout.
    topSpaceToView(self,kMarginH*1.2)
    .widthIs(kMarginW*2)
    .rightSpaceToView(self,kMarginH*2)
    .bottomSpaceToView(self,kMarginH*1.2);
    
    self.separatorLine.sd_layout.
    widthIs(ScreenW)
    .heightIs(0.5)
    .bottomSpaceToView(self,0)
    .leftSpaceToView(self,0);
    
}

-(void)buttonClick:(UIButton*)button
{
    DebugLog(@"tag = %ld",button.tag);

}

//点击消息
-(void)tapGestureView:(id)sender
{

    
}

@end
